<#if po??>

<#if po.importable>
#-- ${po.name} import sql --#
insert into data_import_config(pool, type, note, company_id)
values (@pool, '${po.uncapName}Import', '${po.title!po.name}导入', @companyId);

<#assign total = 0>
<#assign count = 0>
<#list po.importFields as field>
<#assign total = total + 1>
</#list>
insert into data_import_config_item(config_id, title, field, is_required, data_type, company_id) values
<#list po.importFields as field>
<#assign count = count + 1>
((select id from data_import_config where pool = @pool and type = @importType), '${field.title!field.name}', '${field.name}<#if field.dataSourceType?? && field.dataSourceType == "code">Str</#if>', <#if ! field.nullable>1<#else>0</#if>, '<#if field.dataSourceType?? && field.dataSourceType == "code">string<#else>${field.typeName?uncap_first}</#if>', @companyId)<#if count lt total>,<#else>;</#if>
</#list>
</#if>

<#if po.exportable>
#-- ${po.name} export sql --#

insert into data_export_config(pool, type, max_rows, note, company_id)
values (@pool, '${po.uncapName}Export', 100000, '${po.title!po.name}导出', @companyId);

<#assign total = 0>
<#assign count = 0>
<#list po.exportFields as field>
<#assign total = total + 1>
</#list>
insert into data_export_config_item(config_id, title, field, sort, align, company_id) values
<#list po.exportFields as field>
<#assign count = count + 1>
((select id from data_export_config where pool = @pool and type = @exportType), '${field.title!field.relName}', '${field.relName}<#if field.dataSourceType?? && field.dataSourceType == "code">Str</#if>', ${count}, <#if field.number>'right'<#else>'center'</#if>, @companyId)<#if count lt total>,<#else>;</#if>
</#list>
</#if>

</#if>